# -*- coding: UTF-8 -*-
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
import datetime

@login_required
def home(request):
    return render_to_response('userhome/home.html', context_instance=RequestContext(request))

@login_required
def profile(request, user_id):
    return render_to_response('userhome/profile.html',                              
                              context_instance=RequestContext(request))

@login_required
def update_status(request):
    if request.method == 'POST':
        status = request.POST['status']
        if status:
            profile = request.user.get_profile()
            profile.status = status
            profile.last_update_status = datetime.datetime.now()
            profile.save() 
    return HttpResponseRedirect('/profile/%s/' % request.user.id)